#ifndef SPATIALGRID_H
#define SPATIALGRID_H

#include <QObject>
#include <QHash>

#define GRID_SPAN 0.1 //栅格的长度和宽度为多少度
#define GRIDS_PER_DEGREE 10 //每一度有多少个栅格

class SpatialObjectBase;

class SpatialGrid
{
public:
    explicit SpatialGrid(double lowerLeftLongitudeInDegree,double lowerLeftLatidueInDegree);
    void setSurrounding(SpatialGrid *northGrid,SpatialGrid *northEastGrid,SpatialGrid *eastGrid,
                        SpatialGrid *southEastGrid,SpatialGrid *southGrid,
                        SpatialGrid *southWestGrid,SpatialGrid *westGrid,SpatialGrid *northWestGrid);

    QList <SpatialObjectBase*> getSurroundingSpatialObjects();
    QList <SpatialObjectBase*> getSpatialObjects();


    void addOneSpatialObjectPointer(SpatialObjectBase* spatialObjectBase);
    void removeOneSpatialObjectBasePointer(quint64 objectID);


    ~SpatialGrid();

    double lowerLeftLongitudeInDegree,lowerLeftLatidueInDegree;
    SpatialGrid *northGrid,*northEastGrid,*eastGrid,*southEastGrid,*southGrid,
        *southWestGrid,*westGrid,*northWestGrid;

signals:

public slots:

public:

    QHash<quint64, SpatialObjectBase *> getHashIDSpatialObjectBase() const;

private:


    QHash <quint64,SpatialObjectBase*> hashIDSpatialObjectBase; //该栅格中的空间对象列表

};

#endif // SPATIALGRID_H
